package com.abiao.shop.dao;

import com.abiao.shop.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserDao {

    //根据id查找用户名
    @Select("select username from user where id = #{id}")
    String findById(@Param("id")int id);

    //根据id查找用户
    @Select("select * from user where id = #{id}")
    User getById(@Param("id")long id);

    //根据用户名查找用户
    @Select("select * from user where user_name = #{userName}")
    User getByUserName(@Param("userName") String userName);

    //修改密码
    @Update("update user set password = #{password} where id = #{id}")
    void updatePass(User newUser);
}
